<!-- S search -->
<app-search-bar
  [submitLoading]="tableParams.loading"
  [searchOptions]="searchOptions"
  labelFlex="80px"
  (onSearch)="queryResetData($event)"
  (onReset)="queryResetData($event)"
>
</app-search-bar>
<!-- E search -->

<nz-card class="m-t-2">
  <div class="pagination-wrap-position table-wrap">
    <nz-table
      #basicTable
      nzSize="small"
      nzShowSizeChanger
      nzShowQuickJumper
      nzOuterBordered
      [nzScroll]="{ x: '1100px' }"
      [nzFrontPagination]="false"
      [nzLoadingDelay]="100"
      [nzLoading]="tableParams.loading"
      [nzData]="tableParams.tableData"
      [nzPageSizeOptions]="[5, 10, 20, 50, 100]"
      [nzTotal]="tableParams.total"
      [nzPageIndex]="tableParams.page"
      [nzPageSize]="tableParams.pageSize"
      [nzShowTotal]="totalTemplate"
      (nzPageIndexChange)="onPageIndexChange($event)"
      (nzPageSizeChange)="onPageSizeChange($event)"
    >
      <thead>
        <tr>
          <th nzAlign="center" nzWidth="120px">ID</th>
          <th nzAlign="center" nzWidth="150px">姓名</th>
          <th nzAlign="center" nzWidth="150px">联系电话</th>
          <th nzAlign="center" nzWidth="180px">身份证号码</th>
          <th nzAlign="center" nzWidth="150px">身份证图</th>
          <th nzAlign="center" nzWidth="180px">银行卡号</th>
          <th nzAlign="center" nzWidth="160px">银行</th>
          <th nzAlign="center" nzWidth="150px">银行卡图</th>
          <th nzAlign="center" nzWidth="150px">状态</th>
          <th nzAlign="center" nzWidth="170px">申请时间</th>
          <th nzAlign="center" nzWidth="150px" nzRight>操作</th>
        </tr>
      </thead>

      <tbody>
        <tr *ngFor="let data of basicTable.data; let index = index;">
          <!-- ID -->
          <td nzAlign="center">{{ data.id }}</td>
          <!-- 姓名 -->
          <td nzAlign="center">{{ data.userName || '-' }}</td>
          <!-- 联系电话 -->
          <td nzAlign="center">{{ data.phone || '-' }}</td>
          <!-- 身份证号码 -->
          <td nzAlign="center">{{ data.idcard || '-' }}</td>
          <!-- 身份证图 -->
          <td nzAlign="center">
            <div class="flex-wrap-td">
              <span class="idcard-wrap">
                <img
                  nz-image
                  [nzSrc]="data.idcardImgFrontTemp"
                  [nzFallback]="fallback"
                  title="身份证姓名面照片"
                />
              </span>
  
              <span class="idcard-wrap">
                <img
                  nz-image
                  [nzSrc]="data.idcardImgBackTemp"
                  [nzFallback]="fallback"
                  title="身份证国徽面照片"
                />
              </span>
            </div>
          </td>
          <!-- 银行卡号 -->
          <td nzAlign="center">{{ data.bankCard || '-' }}</td>
          <!-- 银行 -->
          <td nzAlign="center">{{ data.bankName || '-' }}</td>
          <!-- 银行卡图 -->
          <td nzAlign="center">
            <div class="flex-wrap-td">
              <span class="idcard-wrap">
                <img
                  nz-image
                  [nzSrc]="data.bankCardImgFrontTemp"
                  [nzFallback]="fallback"
                  title="银行卡正面"
                />
              </span>
            </div>
          </td>
          <!-- 状态 -->
          <td nzAlign="center">
            <span [ngStyle]="{'color': data.status | unionPayDeveloperStatus: 'color'}">
              {{ data.status | unionPayDeveloperStatus: 'label' }}
            </span>
            <i
              *ngIf="data.status === 3"
              nz-icon
              nzType="exclamation-circle"
              nzTheme="outline"
              nz-tooltip
              [nzTooltipTitle]="data.auditOpinion"
            ></i>
          </td>
          <!-- 申请时间 -->
          <td nzAlign="center">{{ data.applicationTime || '-' }}</td>
          <!-- 操作 -->
          <td nzAlign="center" nzRight>
            <ng-container *ngIf="[1, 2, 3].includes(data.status); else elseTemplate">
              <a
                *ngIf="[1, 2, 3].includes(data.status)"
                nz-button
                nzType="link"
                nzSize="small"
                routerLink="/cooperation/cooperation-developer-infos"
                [queryParams]="{id: data.id}"
              >查看</a>

              <button
                *ngIf="data.status === 1"
                nz-button
                nzType="link"
                nzSize="small"
                (click)="showExamineModal(data)"
              >审核</button>
            </ng-container>
            <ng-template #elseTemplate>
              -
            </ng-template>
          </td>
        </tr>
      </tbody>
    </nz-table>

    <!-- 分页template -->
    <ng-template #totalTemplate let-total>共有 {{ total }} 条</ng-template>
  </div>
</nz-card>

<!-- S 审核 Modal -->
<nz-modal
  nzClassName="custom-model-wrap"
  [nzFooter]="null"
  [(nzVisible)]="isExamineVisible"
  [nzTitle]="'审核'"
  (nzOnCancel)="isExamineVisible = false">

  <div *nzModalContent>
    <div class="custom-model-body">
      <nz-textarea-count [nzMaxCharacterCount]="150">
        <textarea
          rows="4"
          nz-input
          maxlength="150"
          placeholder="请输入审核意见"
          [(ngModel)]="auditOpinion"
        ></textarea>
      </nz-textarea-count>
    </div>

    <div class="custom-model-foot">
      <div class="custom-foot-cont">
        <button nz-button nzType="primary" (click)="subExamine(2)">审核通过</button>
        <button nz-button nzType="primary" nzDanger (click)="subExamine(3)">审核不通过</button>
      </div>
    </div>
  </div>
</nz-modal>
<!-- E 审核 Modal -->